import * as actionTypes from './constants'

//添加商品的种类
export const change_selectgoods = (data) =>{
    console.log('action被调用了');
    return {
        type:actionTypes.CHANGE_SELECTGOODS,
        data
    }
}
//添加 商品重复的数量
export const getSelectGoodsCount = (data,index) => {
    return {
        type:actionTypes.CHANGE_SELECTGOODS_COUNT,
        data,
        index
    }
}

//购物车 操作商品的数量  加操作
export const setAddCount = (index) =>{
    return {
        type:actionTypes.SETADD_COUNT,
        index:index//商品种类的下标，
    }
}
// 减操作
export const setSubCount = (index) =>{
    return {
        type:actionTypes.SUBADD_COUNT,
        index:index//商品种类的下标，
    }
}
//判断商品是否被选中
export const setChangeSelect = (index) => {
    return {
        type:actionTypes.CHANGE_SELECT,
        index:index
    }
}
export const setAllSelect = ()=>{
    return{
        type:actionTypes.ALL_SELECT,
    }
}

export const setDeleteState = () =>{
    return{
        type:actionTypes.DELETE_STATE
    }
}
export const deleteGoods = () =>{
    return {
        type:actionTypes.DELETE_GOODS
    }
}
export const settlement  = (sum) =>{
    return {
        type:actionTypes.SETTLEMENT,
        data:sum
    }
}